﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;

/***
 * 
 * Title："AssetBundle简单框架"项目
 *          删除AssetBundle
 * 
 * Description：
 *          功能:
 *              删除指定目录下包文件
 * 
 ***/
namespace ABFW
{
    public class DeleteAssetBundle
    {
        /// <summary>
        /// 批量删除AB包文件
        /// </summary>
        [MenuItem("AssetBundleTools/DeleteAllAssetBundles")]
        public static void DelAssetBundle()
        {
            //删除AB包输出目录
            string strNeedDeleteDIR = string.Empty;

            strNeedDeleteDIR = PathTools.GetABOutPath();
            if (string.IsNullOrEmpty(strNeedDeleteDIR))
            {
                //第二个参数true表示可以删除非空目录,false不让删
                Directory.Delete(strNeedDeleteDIR,true);
                //去除删除警告
                File.Delete(strNeedDeleteDIR+ ".meta");
                //刷新
                AssetDatabase.Refresh();
            }
        }
    }
}
